package com.yao.spider.yiyao.dao;

import com.yao.spider.yiyao.bean.MedicineInfoStandard;
import com.yao.spider.yiyao.mapper.MedicineInfoStandardMapper;
import org.apache.ibatis.session.SqlSession;

import java.util.List;

public class MedicineInfoStandardDaoImpl implements MedicineInfoStandardDao{
    public int insert(MedicineInfoStandard personInfo, SqlSession session) {
        MedicineInfoStandardMapper mapper = session.getMapper(MedicineInfoStandardMapper.class);
        mapper.insert(personInfo);
        session.commit();
        return 1;
    }

    public List<MedicineInfoStandard> selectShiYzNullAll(SqlSession sqlSession) {
        MedicineInfoStandardMapper mapper = sqlSession.getMapper(MedicineInfoStandardMapper.class);
        List<MedicineInfoStandard> medicineInfoStandardList = mapper.selectShiYzNullAll();
        return medicineInfoStandardList;
    }

    public void updateById(SqlSession session, MedicineInfoStandard standard) {
        MedicineInfoStandardMapper mapper = session.getMapper(MedicineInfoStandardMapper.class);
        mapper.updateById(standard);
        session.commit();
    }

    public void updateJyById(SqlSession session, MedicineInfoStandard standard) {
        MedicineInfoStandardMapper mapper = session.getMapper(MedicineInfoStandardMapper.class);
        mapper.updateJyById(standard);
        session.commit();
    }

    public List<MedicineInfoStandard> selectAboutJbNull(SqlSession session) {
        MedicineInfoStandardMapper mapper = session.getMapper(MedicineInfoStandardMapper.class);
        List<MedicineInfoStandard> medicineInfoStandardList =  mapper.selectAboutJbNull();
        return medicineInfoStandardList;
    }

    public List<MedicineInfoStandard> selectAll(SqlSession sqlSession) {
        MedicineInfoStandardMapper mapper = sqlSession.getMapper(MedicineInfoStandardMapper.class);
        List<MedicineInfoStandard> medicineInfoStandardList = mapper.selectAll();
        return medicineInfoStandardList;
    }
}
